
import 'dart:io';

import 'package:flutter_network/service_method.dart';
import 'package:wallet_utils/report_widget/base/callback/base_callback.dart';
import 'package:wallet_utils/report_widget/base/callback/net_request_utils.dart';

import 'mine_url.dart';

class MineApi{
  static getUserInfo(BaseCallback callback) {
    Map<String, dynamic> paramsMap = {};
    return NetRequestUtils.request(
        future: HttpRequest().requestGet(
          MineUrl.getUserInfo,
          params: paramsMap,
        ),
        callback: callback);
  }

  static obtainIndexInfoV2(BaseCallback callback) {
    Map<String, dynamic> paramsMap = {};
    return NetRequestUtils.request(
        future: HttpRequest().requestPost(
          MineUrl.obtainIndexInfoV3,
          params: paramsMap,
        ),
        callback: callback);
  }
  static getHTML(int pageType,BaseCallback callback) {
    Map<String, dynamic> paramsMap = {
      'pageType':pageType,
    };
    return NetRequestUtils.request(
        future: HttpRequest().requestPost(
          MineUrl.getHTML,
          params: paramsMap,
        ),
        callback: callback);
  }

  static consult(String? questionType,String mobile,String content,String filePath,BaseCallback callback) {
    Map<String, dynamic> paramsMap = {
      'mobile':mobile,
      'content':content,
      'filePath':filePath,
      'questionType':questionType
    };
    return NetRequestUtils.request(
        future: HttpRequest().requestPost(
          MineUrl.consult,
          params: paramsMap,
        ),
        callback: callback);
  }

  static uploadFile(File path,BaseCallback callback) {
    return NetRequestUtils.request(
        future: HttpRequest().updateFile(path,
          MineUrl.uploadFile,
        ),
        callback: callback);
  }

  static cancellation(BaseCallback callback) {
    Map<String, dynamic> paramsMap = {};
    return NetRequestUtils.request(
        future: HttpRequest().requestPost(
          MineUrl.cancellation,
          params: paramsMap,
        ),
        callback: callback);
  }

  static getAppVersion(String? appVersion,BaseCallback callback) {
    Map<String, dynamic> paramsMap = {
      'app_version': appVersion,
    };
    return NetRequestUtils.request(
        future: HttpRequest().requestPost(
          MineUrl.getAppVersion,
          params: paramsMap,
        ),
        callback: callback);
  }
}